package com.example.article.controller;

import com.example.article.model.Main;
import com.example.article.service.MainService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(tags="主页模块说明")
@RestController()
public class MainConctrller {
    @Autowired
    private MainService mainService;

    @ApiOperation(value = "新增", notes = "新增一个账户信息")
    @PostMapping("/")
    public Main main() {

        return mainService.mainServicers();
    }
    @ApiOperation(value = "查找", notes = "新增一个账户信息")
    @GetMapping("/login")
    public String Login(@RequestParam("username")String username,@RequestParam("password") String password) {
        if (StringUtils.isNotEmpty(username) &&StringUtils.isNotEmpty(password)) {
            if (username.equals("admin") && password.equals("123")) {
                return "true";
            }else{
                return "false";
            }
        }
        return "账号或密码不能为空";
    }

}
